package com.ruoyi.celoan.job;

import com.ruoyi.celoan.entity.DalianDataReportKeyEntity;
import com.ruoyi.celoan.handanUtils.HanDanHttpUtils;
import com.ruoyi.celoan.service.*;
import com.ruoyi.celoan.service.statistics.ExTradeEffectCreditStatisticsCityService;
import com.ruoyi.celoan.service.statistics.ExTradeEffectCreditStatisticsOrgService;
import com.ruoyi.celoan.service.statistics.ExTradeEffectCreditStatisticsPingtaiService;
import com.ruoyi.celoan.service.statistics.ExTradeEffectEnterprisesDetailSqsService;
import com.ruoyi.celoan.util.InterfaceMapEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
public class HanDanDataReportStatisticsScheduled {
    private static final Logger log = LoggerFactory.getLogger(HanDanDataReportStatisticsScheduled.class);
    @Autowired
    private IEcDalianDataReportStatisticsService dalianDataReportStatisticsService;
    @Autowired
    private ExTradeEffectEnterprisesDetailService exTradeEffectEnterprisesDetailService;
    @Autowired
    private IEcDalianDataReportKeyService keyService;
    @Autowired
    private ExTradeEffectPoliciesDetailService exTradeEffectPoliciesDetailService;
    @Autowired
    private ExTradeEffectInstitutionsstatisticsSummaryService exTradeEffectInstitutionsstatisticsSummaryService;
    @Autowired
    private ExTradeEffectFinancingrequirementsDetailService financingrequirementsDetailService;
    @Autowired
    private ExTradeEffectFinancialproductsDetailService financialproductsDetailService;
    @Autowired
    private ExTradeEffectFinancialinstitutionsDetailService financialinstitutionsDetailService;
    @Autowired
    private ExTradeEffectCreditDetailService exTradeEffectCreditDetailService;
    @Autowired
    private ExTradeEffectCreditStatisticsCityService exTradeEffectCreditStatisticsCityService;
    @Autowired
    private ExTradeEffectCreditStatisticsOrgService exTradeEffectCreditStatisticsOrgService;
    @Autowired
    private ExTradeEffectCreditStatisticsPingtaiService exTradeEffectCreditStatisticsPingtaiService;
    @Autowired
    private ExPrivatelyOperatedStatisticsService exPrivatelyOperatedStatisticsService;
    @Autowired
    private ExTradeEffectEnterprisesDetailSqsService detailSqsService;
    private static String appKey = "CCB004";
    private static String app_secret = "ujh9rrcc59k6es64";
    private static String app_id = "iv63koa14o06lw74";
    private static boolean flag = true;

    public void statisticsFinancing() {
        if (flag) {
            flag = false;
            log.info("加载调用客户端配置");
            DalianDataReportKeyEntity entity = this.keyService.selectEntity(appKey);
            String token = HanDanHttpUtils.getToken();
            log.info("定时任务启动：向信息中心上报数据开始");
            log.info("----------邯郸企业填报信息回传到省节点接口上报开始-------------");
            this.exTradeEffectEnterprisesDetailService.getHanDanDataReport(InterfaceMapEnum.REPORT_QYTB.getDesc(), entity, "130400", token);
            log.info("---------融资需求信息回传接口上报开始-------------");
            this.financingrequirementsDetailService.getHanDanDataReport(InterfaceMapEnum.REPORT_RZXQ.getDesc(), entity, "130400", token);
            log.info("---------金融机构授信放款传到省节点接口上报开始-------------");
            this.exTradeEffectCreditDetailService.getHanDanDataReport(InterfaceMapEnum.REPORT_JRJGSXFK.getDesc(), entity, "130400", token);
            log.info("---------金融机构信息回传接口上报开始-------------");
            this.financialinstitutionsDetailService.getHanDanDataReport(InterfaceMapEnum.REPORT_JRJG.getDesc(), entity, "130400", token);
            log.info("---------金融产品信息回传接口上报开始-------------");
            this.financialproductsDetailService.getHanDanDataReport(InterfaceMapEnum.REPORT_JRCP.getDesc(), entity, "130400", token);
            log.info("----------邯郸政策信息回传到省节点接口上报开始-------------");
            this.exTradeEffectPoliciesDetailService.getHanDanDataReport(InterfaceMapEnum.REPORT_ZCXX.getDesc(), entity, "130400", token);
            log.info("----------邯郸融资统计信息回传接口（按地方维度）上报开始-------------");
            this.exTradeEffectCreditStatisticsCityService.getHanDanDataReport(InterfaceMapEnum.REPORT_TJ_CITY.getDesc(), entity, "130400", token);
            log.info("----------邯郸融资统计信息回传接口（按平台维度）上报开始-------------");
            this.exTradeEffectCreditStatisticsPingtaiService.getHanDanDataReport(InterfaceMapEnum.REPORT_TJ_PINGTAI.getDesc(), entity, "130400", token);
            log.info("----------邯郸融资统计信息回传接口（按机构维度）上报开始-------------");
            this.exTradeEffectCreditStatisticsOrgService.getHanDanDataReport(InterfaceMapEnum.REPORT_TJ_ORG.getDesc(), entity, "130400", token);
            log.info("----------民营企业统计信息回传接口上报开始-------------");
            this.exPrivatelyOperatedStatisticsService.getHanDanDataReport(InterfaceMapEnum.REPORT_TJ_ORG.getDesc(), entity, "130400", token);
        }
    }

    @Scheduled(cron = "0 */1 * * * ?")
    public void statisticsSelectFinancing() {
        if (flag) {
            flag = false;
            this.detailSqsService.getDataReport(InterfaceMapEnum.SQJKCX.getDesc(), "130400");
            log.info("定时任务结束：向信息中心上报数据结束");
        }
    }
}


/* Location:              D:\tuodayun\workspace\work\celoan-third-data-report-service-2.0.0-SNAPSHOT.jar!\BOOT-INF\classes\com\celoan\job\HanDanDataReportStatisticsScheduled.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */
